<template>
<a-card  class="info" title="员工薪酬信息表">
  <div>
    <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :loading="confirmLoading"
        class="j-table-force-nowrap"
        :pagination="ipagination"
        @change="handleChange"
        >
    </a-table>
  </div>
  </a-card>
</template>

<script>

  import { getAction } from '@/api/manage'
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import {DisabledAuthFilterMixin} from '@/mixins/DisabledAuthFilterMixin'

  export default {
    name: 'ErpPayrollLedgerDetail',
    mixins: [JeecgListMixin, DisabledAuthFilterMixin],
    components: {
    },
    data () {
      return {
        model: [],
        id: '',
        url: {
          list: "/api/erp/hr/payment/erpPayrollManagement/list",
        },
        confirmLoading: false,
        iconStyle:{"font-size":"20px"},
        // 列定义
        columns: [
          {
            title:'所属期间',
            align:"center",
            dataIndex: 'period',
            width: 100,
          },
          {
            title:'基础工资',
            align:"center",
            dataIndex: 'basePay',
            width: 100,
          },
          {
            title:'年功工资（元）',
            align:"center",
            dataIndex: 'seniorityWage',
            width: 100,
          },
          {
            title:'等级工资（元）',
            align:"center",
            dataIndex: 'gradedWages',
            width: 100,
          },
          {
            title:'预发绩效',
            align:"center",
            dataIndex: 'advancePerformance',
            width: 100,
          },
          {
            title:'执业金（元）',
            align:"center",
            dataIndex: 'executiveFund',
            width: 100,
          },
          {
            title:'报告审核费',
            align:"center",
            dataIndex: 'reportApplicationFee',
            width: 100,
          },
          {
            title:'项目绩效',
            align:"center",
            dataIndex: 'projectPerformance',
            width: 100,
          },
          {
            title:'前期已结算',
            align:"center",
            dataIndex: 'settledThePreviousPeriod',
            width: 100,
          },
          {
            title:'缺勤扣款',
            align:"center",
            dataIndex: 'absenceDeduction',
            width: 100,
          },
          {
            title:'其它',
            align:"center",
            dataIndex: 'other',
            width: 100,
          },
          {
            title:'其他扣款（元）',
            align:"center",
            dataIndex: 'otherDeductions',
            width: 100,
          },
          {
            title:"应发工资",
            align:"center",
            dataIndex: 'grossPay',
            width: 100,
          },
          {
            title: new Date().getFullYear() + '年累计收入',
            align:"center",
            dataIndex: 'annualCumulativeIncome',
            width: 100,
          },
          {
            title:'下月社保',
            align:"center",
            dataIndex: 'insuranceForNextMonth',
            width: 100,
          },
          {
            title:'当月公积金',
            align:"center",
            dataIndex: 'monthBond',
            width: 100,
          },
          {
            title:new Date().getFullYear() + '年五险一金累计扣款',
            align:"center",
            dataIndex: 'yearFiveInsurancesCount',
            width: 100,
          },
          {
            title:new Date().getFullYear() + '年累计个税专项附加扣除金额',
            align:"center",
            dataIndex: 'yearSpecialCount',
            width: 100,
          },
          {
            title:new Date().getFullYear() + '年应预缴个人所得税',
            align:"center",
            dataIndex: 'yearAdvanceCount',
            width: 100,
          },
          {
            title:new Date().getFullYear() + '年已预缴个人所得税金额',
            align:"center",
            dataIndex: 'yearPaidIndividualCount',
            width: 100,
          },
          {
            title:'本期应预缴个人所得税',
            align:"center",
            dataIndex: 'currentDuePersonal',
            width: 100,
          },
          {
            title:'前期已发放',
            align:"center",
            dataIndex: 'previouslyIssued',
            width: 100,
          },
          {
            title:'实发工资（元）',
            align:"center",
            dataIndex: 'netPayment',
            width: 100,
          }
        ],
        dataSource: [],
        disableMixinCreated: true
      }
    },
    props: {
      employeeId: String
    },
    watch: {
      employeeId: {
        handler: function(val){
          this.initDictConfig(val)
        },
        immediate: true
      },
      // BUG4233 查看多人员工档案信息，信息数据被覆盖
      $route(to, from) {
        this.getData(to.query.id)
      },
    },
    methods: {
      initDictConfig(id) {
        const that = this
        console.log(11111);
        var params = this.getQueryParams() // 查询条件
        console.log(params);
        params.employeeId=id;
        console.log(params);
        getAction(this.url.list,params).then((res) => {
          if (res.success) {
            const dataSource = res.result.records
            this.dataSource=dataSource;
          } else {
            that.$message.warning(res.message);
          }
        })
      },
      handleChange(pagination, filters, sorter) {
        // 分页、排序、筛选变化时触发
        this.filters = {}
        if (Object.keys(filters).length > 0) {
          for (let key in filters) {
            let value = filters[key].join(',')
            if (value) {
              if (key.indexOf('_dictText') != -1) {
                key = key.substring(0, key.indexOf('_dictText'))
              }
              this.filters[key] = value
            }
          }
        }
        if (Object.keys(sorter).length > 0) {
          this.isorter.column = sorter.field
          this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
        }
        this.ipagination = pagination
        this.initDictConfig(this.employeeId)
      },
    }
  }
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';

.info {
  /deep/ .ant-card-head-title{
    flex: none;
    margin-right: 20px;
  }
  /deep/ .ant-card-extra{
    flex: 1;
    float: left;
  }
}
</style>
